﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Threading;
using Microsoft.Xna.Framework.Content;

namespace Ivory
{
    public abstract class LoadScreenBase : Screenbase {
        //Fields
        public TimeSpan LoadingTime;

        //Construct
        public LoadScreenBase(Game game)
            : base(game)
        {
            LoadingTime = TimeSpan.FromSeconds(0);
        }

        //Methods
        #region #@@ Drawing @@#
        public override void drawScreen(SpriteBatch batch, GameTime time)
        {
            RenderLoadScreen(batch, time); 
        }

        public abstract void RenderLoadScreen(SpriteBatch batch, GameTime time);
        
        #endregion

        #region #@@ Updating @@#
        public override void updateScreen(GameTime time)
        {
            LoadingTime += time.ElapsedGameTime;
            //Update the game logic.
            UpdateLoadScreen(time);
        }

        public abstract void UpdateLoadScreen(GameTime time);

        #endregion

        #region #@@ Loading REDUNDANT @@#
        public override void loadScreen(ContentManager content)
        {
            return; //Nothing To-do
        }
        public override void preLoad(ContentManager content)
        {
            LoadAssets(Game.Content);
        }

        public abstract void LoadAssets(ContentManager content);

        #endregion
    }
}
